import request from "@/utils/request";

// 获取轮播图
export function getBanners() {
  return request.get(`api/hospital_banner/index`);
}

// 获取系统配置文章
export function getArticle(body) {
  return request.post(`api/Ajax/getArticleInfo`, body);
}

// 获取个人信息
export function getUserInfo() {
  return request.get(`api/User/getUserInfo`);
}

// 故障申报
export function reportRepair(body) {
  return request.post(`api/User/faultAdd`, body);
}

// 判断当前用户是否是管理员
export function isAdmin() {
  return request.get(`api/User/isAdmin`, undefined, {});
}

// orderUseVerification
export function orderUseVerification(body) {
  return request.post(`api/Order/orderUseVerification`, body);
}

// 开始订单
export function startOrder(body) {
  return request.post(`api/Order/orderUse`, body);
}

// 创建订单
export function createOrder(body) {
  return request.post(`api/Order/index`, body, {
    isPrompt: false,
  });
}

// 生成设备扫码记录
export function createDeviceScan(body) {
  return request.post(`api/DeviceScan/create`, body);
}

// 获取医院
export function getHospital(params) {
  return request.get(`api/hospital/index`, params);
}

// 获取统计数据
export function getStatistics(params) {
  return request.post(`api/Order/list`, params);
}

// 获取员工
export function getStaff(params) {
  return request.get(`api/hospital_staff/index`, params);
}

// 删除员工
export function deleteStaff(id) {
  return request.delete(`api/hospital_staff/delete/${id}`);
}

// 添加员工
export function addStaff(body) {
  return request.post(`api/hospital_staff/add`, body);
}

// 删除员工
export function delStaff(body) {
  return request.post(`api/hospital_staff/delete`, body);
}

// 编辑员工
export function editStaff(body) {
  return request.post(`api/hospital_staff/edit`, body);
}

// 获取员工详情
export function getStaffDetail(id) {
  return request.get(`api/hospital_staff/detail?id=${id}`);
}

// 获取医院的统计数据
export function getHospitalStatistics(body) {
  return request.post(`api/Order/orderStatistics`, body);
}

// 获取我的订单
export function getMyOrder(body) {
  return request.post(`api/Order/getMyOrder`, body);
}

// 获取退款订单
export function getRefundOrder(body) {
  return request.post(`api/Order/getReturnOrder`, body);
}

// 部分退款
export function partRefund(body) {
  return request.post(`api/Order/refund`, body);
}

// 获取科室
export function getDepartment(body) {
  return request.post(`api/Hospital/departments`, body);
}

// 入库操作
export function warehouseOperation(body) {
  return request.post(`api/equipment_storage/add`, body);
}

// 获取设备信息
export function getEquipmentInfo(body) {
  return request.post(`api/equipment_storage/detail`, body);
}

// 入库历史
export function warehouseHistory(body) {
  return request.post(`api/equipment_storage/index`, body);
}

// 巡检
export function inspection(body) {
  return request.post(`api/Equipment_inspection/index`, body);
}

export function addInspection(body) {
  return request.post(`api/Equipment_inspection/add`, body);
}


/* 待巡检设备 */
export function getSpecialInspection(body) {
  return request.post(`api/Equipment_inspection/toInspect`, body);
}


// 获取订单详情
export function getOrderDetail(body) {
  return request.post(`api/Order/detail`, body);
}

// 结束订单
export function endOrder(body) {
  return request.post(`api/Order/endOrder`, body);
}

// 订单状态
export function orderStatus(body) {
  return request.post(`api/Order/orderStatus`, body);
}

// 获取订单详情
export function getOrderDetailNew(body) {
  return request.get(`api/Order/orderDetail?order_sn=${body.order_sn}`);
}

// 上报电量
export function reportPower(body) {
  return request.post(`api/Order/batteryReport`, body);
}

// 设备列表
export function getDeviceList(body) {
  return request.post(`api/Ajax/getEquipmentList`, body);
}

// 零使用率
export function getZeroUseRate(body) {
  return request.post(`api/Ajax/getZeroUseRateEquipment`, body);
}

// 没有上报位置的设备
export function getNoLocationDevice(body) {
  return request.post(`api/equipment_storage/noInStorage`, body);
}

// 发送开锁指令
export function sendOpenLock(body) {
  return request.post(`api/Ajax/sendOpenLockCmd`, body);
}

/* 临时开锁 */
export function temporaryUnlocking(body) {
  return request.post(`api/Ajax/templateSendOpenLockCmd`, body);
}

// 通过设备id获取订单详情
export function getOrderDetailByDeviceId(body) {
  return request.post(`api/Order/getOrderByEquipmentInfo`, body);
}

// 设备互换
export function exchangeDevice(body) {
  return request.post(`api/Ajax/swapEquipmentInfo`, body);
}

// 获取设备详情
export function getDeviceDetail(body) {
  return request.post(`api/Ajax/getEquipmentInfoDetail`, body);
}

// 上报开锁记录
export function reportOpenLock(body) {
  return request.post(`api/Ajax/reportOpenLockRecord`, body);
}


// 获取开锁记录
export function getOpenLockRecord(body) {
  return request.post(`api/Ajax/getOpenLockRecord`, body);
}


// 申请提现
export function applyWithdraw(body) {
  return request.post(`api/User/withdraw`, body);
}